<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>仪表详情</title>
    <!-- 引入element样式 -->
<!--    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.1/theme-chalk/index.css">-->
    <link rel="stylesheet" type="text/css" href="../../static/css/index.css">
</head>
<style>
    .el-form-item{
        padding-top: 15px;
        margin-bottom: 0px;
    }
    .el-input{
        width: 350px;
    }
</style>
<body>
<!--border: 1px;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);-->
    <div id="app" style="height: 100%; width: 700px;margin: 30px auto">
        <p style="text-align: center;">正在加载数据,请稍后...</p>
    </div>
</body>
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>-->
<!--<script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/index.js"></script>-->
<script src="../../static/js/vue.js"></script>
<script src="../../static/js/index.js"></script>
<script src="../../static/js/axios.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            data : {},
            form:{
                name:'',
                id:0
            }
        },
        created:function(){
            var self = this;
            self.form.id = self.getQueryString("id");
            console.log(self.form.id);

            axios.post('http://localhost:8032/device/setCounterIndex', {id: self.form.id}).then(function (res) {

            }).catch(function (error) {
                console.log(error);
            })
            setTimeout(self.goSetCounter, 5000);

        },
        methods: {
            goSetCounter:function () {
                var self = this;
                window.location.href = "setCounter.html?id=" + self.form.id;
            },

            // 获取到url参数的值
            getQueryString: function(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
                var context = "";
                if (r != null)
                    context = r[2];
                reg = null;
                r = null;
                return context == null || context == "" || context == "undefined" ? "" : context;
            }
        }
    })
</script>
</html>